import React, {Component} from 'react';
import { Badge,Card,NoticeBar, Button,Scroller,Popup,Group, Field, Toast,NumberPicker, CheckboxField,SelectField, SwitchField  } from 'saltui';
import $ from 'jquery'
// <InputSwitch value onChange>
export default class InputSelected extends React.Component {

  constructor(props) {

    super(props);
    this.state = {
      // 数据模型
      options: this.props.option,
      // 选中的值
      value: this.props.value
    };
  }

  handleChange =(value) => {
    // 数据确认变更
    this.setState({
      value: value
    });

    this.props.onChange(this.props.id,value.value);

  }

  render() {

    return <SelectField
      options={this.state.options}
      onSelect={this.handleChange}
      value={this.state.value}
      placeholder="请选择"
    />

  }

}
